﻿using System.Collections.Generic;

namespace Mal.Balades.AdminBusiness.DataModel
{
    public partial class FeedAdmin
    {
        #region Fields

        #endregion

        #region Construction / Destruction
        public FeedAdmin(Feed feed)
        {
            this.FeedId = feed.FeedId;
            this.LastUpdate = feed.LastUpdate;
            this.Latitude = feed.Latitude;
            this.Longitude = feed.Longitude;
            this.Name = feed.Name;
            this.Url = feed.Url;

            if (feed.FeedItems != null)
            {
                this.NumberOfFeedItems = feed.FeedItems.Count;
            }
        }
        #endregion

        #region enum, struct, class

        #endregion

        #region Properties

        #endregion

        #region Methods
        public static FeedAdmin Convert(Feed feed)
        {
            return new FeedAdmin(feed);
        }

        public static List<FeedAdmin> Convert(List<Feed> feeds)
        {
            List<FeedAdmin> results = new List<FeedAdmin>();
            foreach (Feed item in feeds)
            {
                results.Add(new FeedAdmin(item));
            }

            return results;
        }
        #endregion

        #region Events

        #endregion
    }
}
